<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <title>购物车</title>
  <script src="./axios.js"></script>
  <style>
    * {
      margin: 0;
      padding: 0;
    }

    img {
      position: absolute;
      left: 50px;
      height: 80%;
    }

    ul {
      list-style: none;
    }

    span {
      user-select: none;
    }

    main {
      width: 990px;
      margin: auto;
    }

    header {
      height: 45px;
      line-height: 45px;
      border: 1px solid #cecece;
      position: relative;
    }

    header input {
      position: absolute;
      left: 20px;
      top: 18px;
    }

    header span {
      top: 2px;
      position: absolute;
    }

    header :nth-child(2) {
      left: 40px;
    }

    header :nth-child(3) {
      left: 110px;
    }

    header :nth-child(4) {
      left: 444px;
    }

    header :nth-child(5) {
      left: 600px;
    }

    header :nth-child(6) {
      left: 815px;
    }

    header :nth-child(7) {
      left: 926px;
    }

    .list {
      height: 110px;
      border: 1px solid #cecece;
      position: relative;
      border-top: none;
    }

    .list span {
      position: absolute;
      top: 45px;
    }

    .list :nth-child(1) {
      position: absolute;
      left: 20px;
      top: 50px;
    }

    .list :nth-child(2) {
      position: absolute;
      left: 100px;
      top: 10px;
    }

    .list :nth-child(3) {
      left: 195px;
      font-size: 14px;
      color: #696969;

    }

    .list :nth-child(4) {
      left: 440px;
      color: red;
    }

    .list :nth-child(5) {
      left: 585px;
      font-size: 30px;
      line-height: 30px;
      top: 38px;
    }

    .list :nth-child(6) {
      text-align: center;
      position: absolute;
      top: 46px;
      width: 20px;
      left: 606px;
    }

    .list :nth-child(7) {
      left: 633px;
      font-size: 26px;
      line-height: 30px;
      top: 38px;
    }

    .list :nth-child(8) {
      left: 800px;
      font-size: 18px;
      color: red;
    }

    .list :nth-child(9) {
      left: 926px;
    }

    #total {
      position: relative;
    }

    #total .allPrice {
      font-size: 20px;
      position: absolute;
      right: 70px;
      top: 20px;
    }

    #total #totalPrice {
      position: absolute;
      left: 920px;
      top: 20px;
      font-size: 20px;
      color: red;
    }

    #total i {
      font-style: normal;
      color: red;
    }

    .pname {
      width: 200px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .total{
      float: right;
      margin-top: 20px;
    }
    .total span{
      margin: 0 3px;
    }
    #cartBox{
      width: 1226px;
      margin: auto;
    }
    #totalPrice{
      color: rgb(248, 57, 57);
      font-size: 20px;
    }
  </style>
</head>

<body>
  <div id="cartBox"></div>
  <script src="cart.js"></script>
  <script>
    login()
function login() {
    var token = localStorage.getItem("token")
    var username = localStorage.getItem("username")
    var userid = localStorage.getItem("userid")
    var login = document.querySelector('.header_right>:nth-child(1)')
    var logout = document.querySelector('.header_right>:nth-child(3)')
    if (token) {
        login.innerHTML = username
        logout.innerHTML = "注销"
        logout.onclick = () => {
            AG('/users/logout', { id: userid }).then(resData => {
                localStorage.removeItem("token")
                login.innerHTML = `<a href="./login1.html">登录</a>`
                logout.innerHTML = `<a href="./login1.html">注册</a>`
            })
        }
    }else{
        
        localStorage.removeItem("cDatas")
    }
}
    // showList("cartBox");
  </script>
</body>

</html>